<?php


ini_set('display_errors', 1);
error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING ^ E_DEPRECATED);
ini_set('memory_limit', '1024M');
require_once '/data/wwwroot/g_vendor/autoload.php';


use Biz\model\GoodsTestActivity\FineGoodsJoinRecordModel;
use Doraemon\model\Phone as PhoneModel;
use hhz\constant\basic\UserExtendPhoneScene;

$data = FineGoodsJoinRecordModel::select('*', ['id[>]' => 0]);
echo '共有'.count($data).'条数据'.PHP_EOL;
$i = 0;
foreach ($data as $item) {
    if (!empty($item['phone']) && $item['encrypt_phone_id']==0) {
        $encryptPhoneId = PhoneModel::addExtendPhone($item['phone'],UserExtendPhoneScene::GOODS_TEST_JOIN_PHONE);
        if ($encryptPhoneId) {
            $upData['encrypt_phone_id'] = $encryptPhoneId;
            FineGoodsJoinRecordModel::update($upData, ['id' => $item['id']]);
        echo '修改成功-id：'.$item['id'].PHP_EOL;
        $i++;
        }

        
    }
}
echo '总共修改'.$i.'条数据'.PHP_EOL;



